<core:wrap file="_cp/page.html" in="content_zone">

<fetch using='src/fetcher/NodeFetcher' target='node' first='true'>
  <fetch:param append_locale='true' />
</fetch>

<h1>Documents list</h1>

<core:datasource id='node'>

<core:optional for='id'>
<iterator:transfer from='parents' target='breadcrumbs' />
You're here: <route_url params='controller:admin_documents'>Documents</route_url>&gt;&gt;
<list:list id='breadcrumbs'>
  <list:item><route_url params='id:{$id}'>{$title}</route_url>&gt;&gt;</list:item>
</list:list>
<b>{$title}</b><br/><br/>
</core:optional>

<core:optional for='object_id'>
<route_url params="action:edit,id:{$id}" extra='?popup=1' onclick='return Limb.Http.click(this.href)' alt='Edit' title='Edit'>Edit current document '{$title}'</route_url>
</core:optional>
<route_url params="action:create" extra='?popup=1&parent={$id}' onclick='return Limb.Http.click(this.href)' alt='Create' title='Create'>Create Document</route_url>

<form name='list_form' method='post'>

<fetch using='src/fetcher/DocumentKidsFetcher' target='kids' navigator='pager' order='node.priority=ASC'>
  <fetch:param parent_id='{$id}'/>
</fetch>

<core:include file='_cp/pager.html'>

<list:list id='kids'>
<table cellpadding="0" cellspacing="0" class='list'>
  <tr class='header'>
    <th class="left"><core:INCLUDE file='_cp/selector.html'></th>
    <th>Order</th>
    <th>Author</th>
    <th>Title</th>
    <th>URL</th>
    <th>Published</th>
    <th>Actions</th>
  </tr>
  <list:item>
    <tr>
      <td class="left"><input type='checkbox' name='ids[]' value='{$node.id}' class='input' runat='client'/></td>
      <td><input type='text' name='priority[{$node.id}]' value='{$node.priority}' class='input' runat='client' size='3'/></td>
      <td>{$author.login}</td>
      <td><route_url params="id:{$node.id}">{$node.title}</route_url></td>
      <td>{$node.url_path}</td>
      <td>
        <limb:OPTIONAL for='is_published'>Yes</limb:OPTIONAL>
        <limb:DEFAULT for='is_published'>No</limb:DEFAULT>
      </td>
      <td><route_url params="action:edit,id:{$node.id}"  extra='?popup=1' onclick='return Limb.Http.click(this.href)' alt='Edit' title='Edit'><img alt="Edit" title="Edit" src="/images/icon/action/edit.gif"/></route_url>
          <route_url params="action:delete" extra='?popup=1&ids[]={$node.id}' onclick='return Limb.Http.click(this.href)' alt='Delete' title='Delete'><img alt="Delete" title="Delete" src="/images/icon/action/delete.gif"/></route_url>
      </td>
    </tr>
  </list:item>
</table>
  <br/>
  <route_url_set field='delete_url' params="action:delete" />
  <input type='submit' value='Delete' onclick='Limb.Form.submit(this.form, "{$delete_url}?popup=1");return false;'/>

  <route_url_set field='publish_url' params="controller:admin_tree,action:publish" />
  <input type='submit' value='Publish' onclick='Limb.Form.submit(this.form, "{$publish_url}?popup=1");return false;'/>

  <route_url_set field='unpublish_url' params="controller:admin_tree,action:unpublish" />
  <input type='submit' value='Unpublish' onclick='Limb.Form.submit(this.form, "{$unpublish_url}?popup=1");return false;'/>

  <route_url_set field='save_order_url' params="controller:admin_tree,action:save_priority" />
  <input type='submit' value='Reorder' onclick='Limb.Form.submit(this.form, "{$save_order_url}?popup=1");return false;'/>
</list:list>

</form>

</core:datasource>

</core:wrap>
